<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p>生命周期</p>
        <input type="text" v-model="msg">
        <p>{{msg}}</p>
    </div>
    <script src="../vue.js"></script>
    <script>
        let vm = new Vue({
            el: '#app',
            data: {
                msg: 'ele'
            },
            beforeCreate() {
                console.log('1-beforeCreate');
                console.log(this.msg);
                console.log(this.$el);
            },
            created() {
                // 在这个钩子函数中发请求
                console.log('2-created');
                console.log(this.msg);
                console.log(this.$el);
            },
            beforeMount() {
                console.log('3-beforeMount');
                console.log(this.$el);
            },
            mounted() {
                console.log('4-mounted');
            },
            beforeUpdate() {
                console.log(5);
            },
            updated() {
                console.log(6);
            },
            beforeDestroy() {
                console.log(7);
            },
            Destroyed() {
                console.log(8);
            }
        })
    </script>
</body>
</html>